home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 1.iso / ARGONET / PD / PROGRAMMING / DESKLIBC / SOURCES.ZIP / DeskLib / !DLSources / Libraries / Window / c / Delete < prev    next >
Text File  |  1995-07-08  |  2KB  |  63 lines

  1. /*
  2.     ####             #    #     # #
  3.     #   #            #    #       #          The FreeWare C library for 
  4.     #   #  ##   ###  #  # #     # ###             RISC OS machines
  5.     #   # #  # #     # #  #     # #  #   ___________________________________
  6.     #   # ####  ###  ##   #     # #  #                                      
  7.     #   # #        # # #  #     # #  #    Please refer to the accompanying
  8.     ####   ### ####  #  # ##### # ###    documentation for conditions of use
  9.     ________________________________________________________________________
  10.  
  11.     File:    Window.Delete.c
  12.     Author:  Copyright © 1992 Jason Williams
  13.     Version: 1.00 (19 Mar 1992)
  14.     Purpose: High-level window management functions: Show/hide a window
  15. */
  16.  
  17.  
  18. #include <stdlib.h>
  19. #include <string.h>
  20.  
  21. #include "DeskLib:LinkList.h"
  22. #include "DeskLib:WimpSWIs.h"
  23. #include "DeskLib:Template.h"
  24. #include "DeskLib:Event.h"
  25. #include "DeskLib:EventMsg.h"
  26. #include "DeskLib:Window.h"
  27. #include "DeskLib:Screen.h"
  28. #include "DeskLib:Error.h"
  29.  
  30. #include "WindowDefs.h"
  31.  
  32.  
  33. extern linklist_header window_listanchor;
  34.  
  35.  
  36.  
  37. extern void Window_Delete(window_handle window)
  38. {
  39.   windowrec       *ptr;
  40.  
  41.   Event_ReleaseWindow(window);       /* Release all handlers for this window */
  42.   EventMsg_ReleaseWindow(window);
  43.  
  44.   Wimp_CloseWindow(window);                                  /* say bye bye! */
  45.   Wimp_DeleteWindow(window);
  46.  
  47.   ptr = (windowrec *) window_listanchor.next;
  48.   while (ptr != NULL)
  49.   {
  50.     if (ptr->window == window)
  51.       break;
  52.     ptr = (windowrec *) ptr->header.next;
  53.   }
  54.  
  55.   if (ptr == NULL)
  56.     return;              /* Window not created with Window_Show(). Bad user! */
  57.  
  58.   LinkList_Unlink(&window_listanchor, &(ptr->header));
  59.  
  60.   Template_Free(&(ptr->memory));     /* Free up the window's indirected data */
  61.   free(ptr);                         /* ... and the window's list entry      */
  62. }
  63.